﻿//-----------------------------------------------------------------------
// <copyright file="PivotTableCellCollection.cs" company="Forebrain Technology, LLC">
//
// Copyright (c) Forebrain Technology, LLC. All rights reserved.
// 
// This source code is released under the Microsoft Public License (Ms-PL).
//
// </copyright>
//-----------------------------------------------------------------------
namespace PivotCollectionTools.Data
{
    using System;
    using System.Collections.ObjectModel;
    using System.Linq;

    /// <summary>
    /// A collection of Pivto Tabel Cell objects.
    /// </summary>
    [Serializable]
    public class PivotTableCellCollection : Collection<PivotTableCell>
    {
        /// <summary>
        /// Gets the <see cref="PivotCollectionTools.Data.PivotTableCell"/> with the specified column name.
        /// </summary>
        /// <param name="columnName">The column name.</param>
        public PivotTableCell this[string columnName]
        {
            get
            {
                var itemCell = this.Items.FirstOrDefault(c => c.Column.Name == columnName);
                return itemCell;
            }
        }
    }
}
